package ve.ejb.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author memozac
 */
@Entity
public class PersonProfile implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idPersonProfile;

    @ManyToOne
    @JoinColumn(name="idPerson",nullable=false,updatable=true)
    private Person person;

    @ManyToOne
    @JoinColumn(name="idProfile",nullable=false,updatable=true)
    private Profile profile;

    @Temporal(value = TemporalType.TIMESTAMP) private Date registerDate;

    public Date getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }
    
    public Long getIdPersonProfile() {
        return idPersonProfile;
    }

    public void setIdPersonProfile(Long idPersonProfile) {
        this.idPersonProfile = idPersonProfile;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    public Profile getProfile() {
        return profile;
    }

    public void setProfile(Profile profile) {
        this.profile = profile;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPersonProfile != null ? idPersonProfile.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof PersonProfile)) {
            return false;
        }
        PersonProfile other = (PersonProfile) object;
        if ((this.idPersonProfile == null && other.idPersonProfile != null) || (this.idPersonProfile != null && !this.idPersonProfile.equals(other.idPersonProfile))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bsc.ejb.entity.PersonProfile[id=" + idPersonProfile + "]";
    }

}//ends of class
